package com.demo5;

/**
 * Created by Administrator on 2017/3/26.
 */
class Animal {
    String type;
    String name;
    int age;
    int weight;

    void eat() {
        System.out.println("animal eat");
    }

    void breath() {
        System.out.println("animal breath");
    }

    void sleep() {
        System.out.println("animal sleep");
    }
    public String toString(){
        String returnString=null;
        returnString="名字: "+this.name+"\n"+"种类: "+this.type+"\n"+"年龄: "+this.age+"\n"+"体重："+this.weight;
        return returnString;
    }
}

class Tiger extends Animal {
    String tigerType;
    String from;

    void tigerRun() {
        System.out.println("the tiger run");
    }
}

public class JiCheng {
    public static void main(String[] args) {
        Tiger tiger = new Tiger();
        tiger.type = "Tiger";
        tiger.name = "huhu";
        tiger.age = 12;
        tiger.weight = 120;
        tiger.tigerType = "东北虎";
        tiger.from = "长白山";
        System.out.println("Animal属性:种类=" + tiger.type);
        System.out.println("Animal属性:名字=" + tiger.name);
        System.out.println("Animal属性:年龄=" + tiger.age);
        System.out.println("Animal属性:体重=" + tiger.weight);
        System.out.println("Tiger属性:老虎种类=" + tiger.tigerType);
        System.out.println("Tiger属性:产地=" + tiger.from);
        System.out.println("Animal方法: 呼吸");
        tiger.breath();
        System.out.println("Animal方法: 吃饭");
        tiger.eat();
        System.out.println("Animal方法: 睡觉");
        tiger.sleep();
        System.out.println("Tiger方法: 奔跑");
        tiger.tigerRun();
    }
}
